package java925;

import java.util.Scanner;

//1、使用二维数组存储班上五个学生三门功课的考试成绩，
// 要求输出每一个学生的总分、平均分、最高分、最低分
// int a[][] = {{100, 90, 80}, {90, 89, 60}, {99, 98, 97}, {85, 78, 41}, {90, 80, 88}};
public class Test1 {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        double[][] a = new double[5][3];
        for (int i = 0; i < a.length; i++) {

            System.out.println("----------请输入第" + (i + 1) + "个学生--------");
            for (int j = 0; j < a[i].length; j++) {
                System.out.print("请输入第" + (i + 1) + "个学生,第" + (j + 1) + "门考试的成绩：");
                double b = input.nextDouble();
                a[i][j] = b;
            }
        }
        System.out.println("----------统计成绩---------------");
        for (int i = 0; i < a.length; i++) {
            double sum = 0;
            double avg = 0;
            double max = 0;
            double min = 0;
            for (int j = 0; j < a[i].length; j++) {
                min = max = a[i][0];
                if (max < a[i][j]) {
                    max = a[i][j];
                }
                if (min > a[i][j]) {
                    min = a[i][j];
                }
                sum += a[i][j];
            }
            avg = sum / 3;
            System.out.println("第" + (i + 1) + "个学生的总分：" + sum + "\n平均分：" + avg + "\n最高分：" + max + "\n最低分：" + min);
        }


    }
}
